#include <stdio.h>
/*
求近似值：π/4
*/
int main()
{
    double sum = 0, trem;
    int n = 0;
    do
    {
        trem = 1 / (n * 2.0 + 1);
        if (n % 2 == 0)
            sum += trem;
        else
            sum -= trem;
        n++;
    } while (trem > 10e-6);//原书中这里是1e-6我认为是10e-6，因为题目要求是10的负6次幂
    printf("%f\n", sum);
    return 0;
}